package com.luying.controller.controller;

import com.luying.pojo.PageQuery;
import com.luying.pojo.Result;
import com.luying.pojo.UserRole;
import com.luying.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @PostMapping("/add")
    public Result add(@RequestBody UserRole userRole){
        return Result.ok(roleService.add(userRole));
    }

    @GetMapping("/userAndRole/list")
    public Result userList(){
        return Result.ok(roleService.userList());
    }

    @PostMapping("/query")
    public Result query(@RequestBody PageQuery pageQuery){
        return Result.ok(roleService.query(pageQuery));
    }
}
